package com.dyson.concurrent.collections;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

/**
 * @ClassName: TetsLinkedBlockingDeque08
 * @Date: 2020/7/22 11:29
 * @Author: WY
 * @Email: dysonwy@foxmail.com
 * @Desc:
 * 双端队列:
 * 1.可以从头部获取,也可以从尾部获取
 * 2.可以从尾部添加,也可以从头部添加
 */
public class TetsLinkedBlockingDeque08 {
    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<String> blcDQ = new LinkedBlockingDeque<>();
//        BlockingQueue<String> blcQ=new LinkedBlockingDeque<>(3);
        blcDQ.add("1");
        blcDQ.add("2");
        blcDQ.add("3");
        blcDQ.add("4");
        System.out.println("阻塞队列是：" + blcDQ);
//        System.out.println("获取到的是："+blcDQ.remove());
        blcDQ.addFirst("0");
//        System.out.println("获取到的是："+blcDQ.removeLast());
        System.out.println("阻塞队列是：" + blcDQ);
        System.out.println("主线程执行完毕！！！");
    }
}
